BIN=bite.exe
#SRC=$(shell ls *.c)
SRC=$(wildcard *.c) # wildcard函数，获取当前目录下的所有的源文件
OBJ=$(SRC:.c=.o)
CC=gcc
Echo=echo
Rm=rm -rf

$(BIN):$(OBJ)
	@$(CC) -o $@ $^
	@$(Echo) "linking $^ to $@ ... done"
%.o:%.c
	@$(CC) -c $<
	@$(Echo) "compiling $< to $@ ... done"

.PHONY:clean
clean:
	$(Rm) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo "Debug-------"
	@echo $(SRC);
	@echo "Debug-------"
	@echo $(OBJ);
	@echo "Debug-------"

#BIN=bite.exe
#SRC=test.c
#
#$(BIN):$(SRC)
#	@echo "开始编译代码"
#	gcc -o $@ $^
#	@echo "编译完成"
#.PHONY:clean
#clean:
#	@echo "清理 工程..."
#	rm -f $(BIN)
#	@echo "清理完毕..."
